package com.study.uploadcsv.controller;

import com.study.uploadcsv.service.UploadCSVService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author weixiaochun
 * @date 2022/7/19 20:16
 */
@RestController
@RequestMapping("/csv")
public class UploadCSVController {

    @Resource
    private UploadCSVService uploadCSVService;

    @GetMapping("/upload")
    public void test(HttpServletResponse response) throws IOException {
        uploadCSVService.upload(response);
    }

    @GetMapping("/readFile")
    public String readFile() throws IOException {
        return uploadCSVService.readFile("D:\\study\\data\\temp-data\\result10.txt");
    }

}
